package com.ycsj.goldmedalnewconcept.activity;

import io.rong.imkit.tools.PhotoFragment;
import io.rong.imkit.tools.PhotoFragment.PhotoDownloadListener;
import io.rong.imlib.model.Message;
import io.rong.message.ImageMessage;
import android.annotation.SuppressLint;
import android.net.Uri;
import android.os.Bundle;

import com.ycsj.goldmedalnewconcept.R;

@SuppressLint("NewApi")
public class PhotoActivity extends BaseJpStarActivity {

	private PhotoFragment mPhotoFragment;

	@Override
	protected void onCreate(Bundle arg0) {
		// TODO Auto-generated method stub
		super.onCreate(arg0);
		setContentView(R.layout.de_ac_photo);
		
		mPhotoFragment = (PhotoFragment) getSupportFragmentManager().findFragmentById(R.id.photo_fragment);
		
		 Message message = getIntent().getParcelableExtra("message");
	        ImageMessage imageMessage = (ImageMessage) message.getContent();
	        Uri uri = imageMessage.getLocalUri() == null ? imageMessage.getRemoteUri() : imageMessage.getLocalUri();
	
	        mPhotoFragment.initPhoto(message,new PhotoDownloadListener() {
				
				@Override
				public void onDownloaded(Uri arg0) {
					// TODO Auto-generated method stub
					
				}
				
				@Override
				public void onDownloadError() {
					// TODO Auto-generated method stub
					
				}
			});
	        	
	        	
	}

}
